package com.imti.mapper;

import com.imti.bean.Nduty;
import com.imti.bean.Nurse;
import com.imti.bean.pojo.Dutya;
import com.imti.bean.pojo.NdutyVo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

public interface NdutyVoDao {

    /*总条数*/
    /*@Select("")*/
    public int ndutyConut(NdutyVo ndutyVo);

    //查全部
    /*@Select("")*/
    public List<NdutyVo> selectAll(Map<String,Object> map);

    //添加
    @Insert("INSERT INTO `nurse_duty` (nurse_id,nampm,nduty_date,desk_id)\n" +
            "VALUES(#{nurseId},#{nampm},#{ndutyDate},#{deskId})")
    public int insertAll(NdutyVo ndutyVo);

    /*查询护士名字和id*/
    @Select("SELECT nurse_id AS nurseId,nurse_name AS nurseName,desk_id AS deskId FROM nurse")
    public List<Nurse> select();


    /* 根据id查询值班信息*/
    @Select("SELECT nd.*,n.nurse_name,dw.desk_name\n" +
            "FROM nurse_duty nd ,nurse n,desk_work dw\n" +
            "WHERE nd.nurse_id = n.`nurse_id`\n" +
            "AND nd.desk_id= dw.`desk_id`" +
            " and nd.nduty_id = #{ndutyId}")
    public List<NdutyVo> selectOne(NdutyVo ndutyId);

    /*根据ndutyId修改数据*/
    public int update(NdutyVo ndutyVo);
}
